package dev.pda.display.presentation.page.render

import android.content.Context
import dev.pda.display.presentation.page.model.WidgetModel
import java.lang.reflect.Type

abstract class WidgetRender<T : WidgetModel<*>> protected constructor(
    context: Context?,
    val type: Type
) {
    private var model: T? = null
    protected var context:Context?
    abstract val layoutView:Int
    abstract fun destroy()
    abstract fun bindView(model: T,position:Int)

    init {
        this.context = context
    }

    fun performBindView(model: T?,position: Int){
        model?.let {
            bindView(it,position)
            this.model = it
        }
    }
}